#pragma once

#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <string>

using namespace std;

enum QuestionOption
{
	OptionA		=	1,
	OptionB		=	2,
	OptionC		=	3,
	OptionD		=	4,
	OptionMax	=	5
};

struct Word
{
	int m_WordID;
	wstring m_WordName;
	wstring m_Trans;
};

class Question
{
public:
	int m_QuestionID;
	wstring m_Title;
	wstring m_Answer;
	wstring m_Options[OptionMax];
};

struct QuestionPool
{
	vector<Question> m_Questions;
	int m_Size;
};

class QuestionProvider
{
public:
	QuestionProvider();
	QuestionPool* m_QuestionPool;
	wstring GetCurrentQuestionTitle();
	wstring GetCurrentQuestionAnswer();
	wstring GetCurrentOptionA();
	wstring GetCurrentOptionB();
	wstring GetCurrentIndexString();
	bool BindQuestionPool(QuestionPool*);
	bool IsLastQuestion();
	void Next();
	

private:
	int m_CurrentIndex;
};

class QuestionFactory
{
public:
	void LoadQuestionPool(QuestionPool*);
	void LoadWordList();

private:
	vector<Question> m_QuestionList;
	vector<Word> m_WordList;
	void PackOneQuestion(int,wstring title,wstring answer,wstring optionA,wstring optionB);
	void PackOneWord(int wId,wstring name,wstring tran);
	void PickMixedOption(Question*);
};